home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 September / maximum-cd-2000-09.iso / Vampire the Masquerade / vampire_demo.exe / Codex.nob / DisciplineCommand.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-22  |  2.4 KB  |  62 lines

  1. public class DisciplineCommand extends Discipline {
  2.    private static final String DISCIPLINE_NAME = "Command";
  3.  
  4.    public boolean cancast(int level, int casterGuid, int targetGuid, float x, float y, float z, boolean bIsPos) {
  5.       if (!((Discipline)this).CheckCastParameters(level, casterGuid, "Command")) {
  6.          return false;
  7.       } else if (!((Discipline)this).CheckCastTarget(targetGuid, "Command")) {
  8.          return false;
  9.       } else if (Codex.IsPlayerGuid(targetGuid)) {
  10.          ((Discipline)this).DisplayNoCast("RPG_DISC_NOPOSSESSION");
  11.          return false;
  12.       } else {
  13.          return true;
  14.       }
  15.    }
  16.  
  17.    public int cast(int level, int casterGuid, int targetGuid) {
  18.       if (!((Discipline)this).CheckCastParameters(level, casterGuid, "Command")) {
  19.          return 0;
  20.       } else if (!((Discipline)this).CheckCastTarget(targetGuid, "Command")) {
  21.          return 0;
  22.       } else {
  23.          ((Discipline)this).SetupWorld("Command");
  24.          if (((Discipline)this).Fizzled(level)) {
  25.             ((Discipline)this).DisplayFizzle("Command", level);
  26.             return 0;
  27.          } else {
  28.             try {
  29.                ((Discipline)this).DisplayCast("Command", level);
  30.                float clanFactor = 1.0F;
  31.                if (super.targetThing.GetActorClanId() == 12) {
  32.                   clanFactor = 0.5F;
  33.                }
  34.  
  35.                if (super.targetThing.GetActorClanId() == 9) {
  36.                   clanFactor = 0.5F;
  37.                }
  38.  
  39.                if ((super.targetThing.AIGetMindFlags() & 8) == 0 && super.targetThing.GetActorStat(9) >= super.casterThing.GetActorStat(9) && Math.random() * (double)super.targetThing.GetActorStat(5) * (double)clanFactor < Math.random() * (double)super.casterThing.GetActorStat(12)) {
  40.                   int effectGuid = super.targetThing.FindActorEffect("ef_disc_command");
  41.                   if (effectGuid != 0) {
  42.                      super.targetThing.RemoveActorEffect(effectGuid);
  43.                   }
  44.  
  45.                   super.targetThing.AddActorEffectByLevel("ef_disc_command", Discipline.COMMAND_DURATIONS[level], level, casterGuid, 4);
  46.                } else {
  47.                   ((Discipline)this).DisplayResist("Command", level);
  48.                }
  49.  
  50.                return 1;
  51.             } catch (Exception var7) {
  52.                CodexConsole.PrintException(((Throwable)var7).getMessage() + " in " + "Command" + " [cast]");
  53.                return 0;
  54.             } catch (Error var8) {
  55.                CodexConsole.PrintError(((Throwable)var8).getMessage() + " in " + "Command" + " [cast]");
  56.                return 0;
  57.             }
  58.          }
  59.       }
  60.    }
  61. }
  62.